namespace ScrumSprintMonitor.UI.Wpf.Converters
{
	#region #using Directives

	using System;
	using System.Globalization;
	using System.Windows.Data;
	using System.Windows.Media;

	#endregion

	public class ColorToBrushValueConverter : BaseColorToSolidBrushValueHelper,
	                                          IValueConverter
	{
		#region IValueConverter Members

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value is Color)
			{
				var val = (Color) value;

				return GetBrushFromColor(val);
			}

			return null;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value is SolidColorBrush)
			{
				var val = (SolidColorBrush) value;

				return val.Color;
			}

			return null;
		}

		#endregion
	}
}